package com.example.module_clocking.repo

import com.example.module_clocking.model.ClockingBody
import com.example.module_clocking.net.ApiService
import com.example.module_clocking.net.ClockingNetModule
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.flowOn
import javax.inject.Inject

class ClockingRepo @Inject constructor() {
    @Inject
    @ClockingNetModule.CommonMainApi
    lateinit var api: ApiService
    fun clocking(clockingBody: ClockingBody) =
        flow {
            emit(api.clocking(clockingBody))
        }.flowOn(Dispatchers.IO)
    fun getClockingList(id:Int) =
        flow {
            emit(api.getClockingList(id))
        }.flowOn(Dispatchers.IO)
}